<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<button onclick="addOne()">加1</button>
		<script>
			var array = [];
			
			Object.defineProperty(array, 'push', {
			  enumerable: false,
			  configurable: true,
			  writable: true,
			  value: function() {
			    var args = Array.prototype.slice.call(arguments);
			    var result = Array.prototype.push.apply(this, args);
				console.log(result)
			    // 数组发生变化后触发自定义事件
			    console.log('数组发生了变化'+args);
			
			    return result;
			  }
			});
			
			
			
			
			function addOne(){
				console.log('111')
				// 测试添加元素到数组
				array.push(1);
			}
		</script>
	</body>
</html>